/**
 * package: request
 * author: zhaiyujin
 * description:
 */
package request

import (
	"github.com/kataras/iris/v12"
	"huanteng/vendors/copit-master"
	"huanteng/vendors/validator"
	"huanteng/web/models"
)

type SaveAdmin struct {
	Name string `json:"username" validate:"required" `
	Status *uint `json:"status"`
	Pwd string `json:"pwd"`
}
func (s *SaveAdmin) Validate(ctx iris.Context,admin *models.Admin)(err error){
	post:=SaveAdmin{}

	err=validator.ValidateInfo(ctx.ReadJSON(&post))
	if err!=nil{
		return
	}
	err=copit.Copy(&admin,&post)
	if err!=nil{
		return
	}
	return nil
}
